package sv.com.globalsolutionslt.manejador;

import sv.com.globalsolutionslt.entidades.Rubro;
import java.io.Serializable;
import java.util.Calendar;
import java.util.List;
import javax.ejb.EJB;
import javax.faces.event.ActionEvent;
import javax.inject.Named;
import javax.faces.view.ViewScoped;
import sv.com.globalsolutionslt.controlador.RubroFacade;

@Named(value = "rubroController")
@ViewScoped
public class RubroController extends AbstractController<Rubro> implements Serializable {

    @EJB
    private RubroFacade RubroFacade;
    private List<Rubro> lrubro;

    public RubroController() {
        super(Rubro.class);
    }

    @Override
    public void save(ActionEvent event) {
        super.getSelected().setFechaMod(Calendar.getInstance().getTime());
        super.getSelected().setUsuarioMod(1);
        super.save(event); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public void saveNew(ActionEvent event) {
        super.getSelected().setFechaMod(Calendar.getInstance().getTime());
        super.getSelected().setUsuarioMod(1);
        super.saveNew(event); //To change body of generated methods, choose Tools | Templates.
    }

    public List<Rubro> getlrubro() {
        lrubro = RubroFacade.bRubroPer(2);
        return lrubro;
    }

}
